unit loader;

interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, regexpr, usublist, engine, defaults;

type
  TLoader = class
  public
    constructor create(loading_mainform: TForm);
    destructor destroy;
    procedure start(loading_msg: string);
    procedure stop(stop_caption: string);
  private
    msg: string;
    form: TForm;
    loading_timer: TTimer;
    number_of_pixels: Integer;
    procedure ontimer1(sender: TObject);
  end;



implementation

constructor TLoader.create(loading_mainform: TForm);
begin
  form := loading_mainform;
  loading_timer := TTimer.Create(nil);
  loading_timer.Enabled := False;
  loading_timer.Interval := 200;
  loading_timer.OnTimer := ontimer1;
end;

procedure TLoader.start(loading_msg: string);
begin
  msg := loading_msg;
  form.Caption := msg;
  number_of_pixels := 0;
  loading_timer.Enabled := True;
end;

procedure TLoader.stop(stop_caption: string);
begin
  loading_timer.Enabled := False;
  form.Caption := stop_caption;
end;

procedure TLoader.ontimer1(sender: TObject);
var
  i: integer;
  add_msg: string;
begin

  add_msg := '';
  for i := 0 to number_of_pixels do
    add_msg := add_msg + '.';

  number_of_pixels := number_of_pixels + 1;

  form.Caption := msg + add_msg;

end;

destructor TLoader.destroy;
begin
  loading_timer.destroy;
end;

end.
